package com.myfoon.view.context.helper;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class EJBReceiver {
    private Context ctx;
    
    public EJBReceiver() { 
        try {
         this.ctx = new InitialContext();
        }
        catch (NamingException e) {
            e.printStackTrace();
        }
    }
    
    public Object receiveEJB(String jndiName) {                
        Object foundEntity = null;        
                        
        try {            
            foundEntity = ctx.lookup(jndiName);        
        } catch (NamingException e) {
            e.printStackTrace();
        }
        
        return foundEntity;
    }
}
